//
// Created by hsj on 2022/3/9.
//

#include "t_list.h"
namespace t_list_test{

    void out_int(int &n){
        cout<<n<<endl;
    };

    //test
    void test(){
       list<int> one(5,2);
       int stuff[5]{1,2,4,8,6};

       list<int> two;
       two.insert(two.begin(),stuff,stuff + 5);

       int more[6]{6,4,2,4,6,5};
       list<int> three(two);
       three.insert(three.end(),more,more + 6);

       cout<<"list of one:"<<endl;
       for_each(one.begin(),one.end(),out_int);

       cout<<"list of two:"<<endl;
       for_each(two.begin(),two.end(),out_int);

       cout<<"list of three:"<<endl;
       for_each(three.begin(),three.end(),out_int);
       //删除值等于2的节点
       three.remove(2);
       cout<<"list of three(remove):"<<endl;
       for_each(three.begin(),three.end(),out_int);

    }

}